package zhihuilan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import zhihuilan.dto.MySearchDto;
import zhihuilan.entity.MyAcquisition;
import zhihuilan.entity.MyAcquisitionMsgExtra;
import zhihuilan.entity.MySearch;
import zhihuilan.params.query.MySearchQueryParam;

import java.util.List;

@Mapper
public interface MySearchMapper extends BaseMapper<MySearch> {

//    @Select("select * from ")
//    List<MySearch> getSearchList(MySearchQueryParam mySearchQueryParam,List keywordList);


    @Select({" <script> select a.*,b.userreal userreal,b.telephone tphone,b.headimgurl user_logo from my_acquisition_msg a " +
            " left join my_staff b on a.staff_id = b.id \n" +
            " where a.status =1 \n" +
            " <when test='staffId != null and staffId != \"\"'> " +
            "  and a.staff_id = #{staffId} \n" +
            " </when> " +
            " <when test='pid != null and pid != \"\"'> " +
            "  and a.pid = #{pid} \n" +
            " </when> " +
            " order by create_time desc LIMIT #{page},#{pageSize} " +
            " </script>"})
    List<MySearchDto> selectMySearchDto(@Param("page") Long page, @Param("pageSize") Long pageSize, @Param("pid") Integer pid, @Param("staffId") Integer staffId);

}
